<?php if (! defined('BASEPATH')) exit('No direct script access allowed');
class Page extends Controller {
	/*定义映射表名*/
	var $controller  = 'page';	
	function Page(){
		parent::Controller();
		$this->load->model('crud');
		$this->load->model('display');
	}
	
	function index(){
		echo 'Page';		
	}
	
	function page_view($id = NULL){
		
	}
	
	function page_list(){
		$result = $this->crud->read($this->controller,'id,title,heading,content,posted');
		var_dump($result);
		}	
	function page_new(){		
		$data = $this->display->data;
		$data['mytitle'] = 'Add New Page';
		$data['form_open'] = form_open('Page/page_save');
		//创建标题输入框
		$page_title = array(
		'name'        => 'title',
		'value'       => 'Page Title',
		);
		$data['page_title'] = form_input($page_title);
		//创建内容输入框
		$page_content = array(
		'name'        => 'content',
		'value'       => 'Page Content',
		'maxlength'   => '50',
		'size'        => '50',
		);
		$data['page_content'] = form_textarea($page_content);
		//创建提交按钮
		$data['page_submit'] = form_submit('submit','Submit');
		//加载视图
		$this->load->view('base/header_view',$data);
		$this->load->view('base/profile_view');
		$this->load->view('base/favorite_view');
		$this->load->view('base/menu_view');		
		$this->load->view('base/help_view');
		$this->load->view('derived/page_new');
		$this->load->view('base/footer_view');
				
	}
	
	function page_save(){
		echo "Page has saved!";
	}
	
	function page_del($id = NULL)
	{
		
	}
	
	function page_edit($id = NULL)
	{
		
	}
}
?>